#include "loginwindow.h"

#include <QApplication>

#include "loginwindow.h"
#include "sdkmanager.h"
#include "mainwindow.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    SdkManager sdk_mgr;
    if (!sdk_mgr.Init()) {
        qDebug() << "Init sdk manager failed";
        return -1;
    }

    LoginWindow loginWindow(&sdk_mgr);
    loginWindow.show();

    QObject::connect(&loginWindow, &LoginWindow::LoginSuccess, [&](const std::string& user_id) {
        loginWindow.close();
        MainWindow *mainWindow = new MainWindow(user_id, &sdk_mgr);
        mainWindow->Init();
        mainWindow->show();
    });

    return app.exec();
}
